package org.gap.domain;

import java.io.Serializable;

import java.lang.StringBuilder;

import java.util.Calendar;

import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;

import javax.xml.bind.annotation.*;

import javax.persistence.*;

/**
 */

@Entity
@NamedQueries({
		@NamedQuery(name = "findAllPersistentLoginss", query = "select myPersistentLogins from PersistentLogins myPersistentLogins"),
		@NamedQuery(name = "findPersistentLoginsByLastUsed", query = "select myPersistentLogins from PersistentLogins myPersistentLogins where myPersistentLogins.lastUsed = ?1"),
		@NamedQuery(name = "findPersistentLoginsByPrimaryKey", query = "select myPersistentLogins from PersistentLogins myPersistentLogins where myPersistentLogins.series = ?1"),
		@NamedQuery(name = "findPersistentLoginsBySeries", query = "select myPersistentLogins from PersistentLogins myPersistentLogins where myPersistentLogins.series = ?1"),
		@NamedQuery(name = "findPersistentLoginsBySeriesContaining", query = "select myPersistentLogins from PersistentLogins myPersistentLogins where myPersistentLogins.series like ?1"),
		@NamedQuery(name = "findPersistentLoginsByToken", query = "select myPersistentLogins from PersistentLogins myPersistentLogins where myPersistentLogins.token = ?1"),
		@NamedQuery(name = "findPersistentLoginsByTokenContaining", query = "select myPersistentLogins from PersistentLogins myPersistentLogins where myPersistentLogins.token like ?1"),
		@NamedQuery(name = "findPersistentLoginsByUsername", query = "select myPersistentLogins from PersistentLogins myPersistentLogins where myPersistentLogins.username = ?1"),
		@NamedQuery(name = "findPersistentLoginsByUsernameContaining", query = "select myPersistentLogins from PersistentLogins myPersistentLogins where myPersistentLogins.username like ?1") })
@Table(schema = "GAP", name = "PERSISTENT_LOGINS")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(namespace = "GAP/org/gap/domain", name = "PersistentLogins")
public class PersistentLogins implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 */

	@Column(name = "SERIES", length = 64, nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@Id
	@XmlElement
	String series;
	/**
	 */

	@Column(name = "USERNAME", length = 64, nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String username;
	/**
	 */

	@Column(name = "TOKEN", length = 64, nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String token;
	/**
	 */
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "LAST_USED", nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	Calendar lastUsed;

	/**
	 */
	public void setSeries(String series) {
		this.series = series;
	}

	/**
	 */
	public String getSeries() {
		return this.series;
	}

	/**
	 */
	public void setUsername(String username) {
		this.username = username;
	}

	/**
	 */
	public String getUsername() {
		return this.username;
	}

	/**
	 */
	public void setToken(String token) {
		this.token = token;
	}

	/**
	 */
	public String getToken() {
		return this.token;
	}

	/**
	 */
	public void setLastUsed(Calendar lastUsed) {
		this.lastUsed = lastUsed;
	}

	/**
	 */
	public Calendar getLastUsed() {
		return this.lastUsed;
	}

	/**
	 */
	public PersistentLogins() {
	}

	/**
	 * Copies the contents of the specified bean into this bean.
	 *
	 */
	public void copy(PersistentLogins that) {
		setSeries(that.getSeries());
		setUsername(that.getUsername());
		setToken(that.getToken());
		setLastUsed(that.getLastUsed());
	}

	/**
	 * Returns a textual representation of a bean.
	 *
	 */
	public String toString() {

		StringBuilder buffer = new StringBuilder();

		buffer.append("series=[").append(series).append("] ");
		buffer.append("username=[").append(username).append("] ");
		buffer.append("token=[").append(token).append("] ");
		buffer.append("lastUsed=[").append(lastUsed).append("] ");

		return buffer.toString();
	}

	/**
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = (int) (prime * result + ((series == null) ? 0 : series.hashCode()));
		return result;
	}

	/**
	 */
	public boolean equals(Object obj) {
		if (obj == this)
			return true;
		if (!(obj instanceof PersistentLogins))
			return false;
		PersistentLogins equalCheck = (PersistentLogins) obj;
		if ((series == null && equalCheck.series != null) || (series != null && equalCheck.series == null))
			return false;
		if (series != null && !series.equals(equalCheck.series))
			return false;
		return true;
	}
}
